<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .active{
            color: red;
        }
    </style>
</head>
<body>

<div id="app">
    <h2 v-bind:class="{active: isActive, line: isLine}">{{message}}</h2><!--可在后台更改类名-->
    <h2 v-bind:class="getClasses()">{{message}}</h2><!--可在后台更改类名-->
    <button v-on:click="btnClick">按钮</button>

    <h2 class="title" v-bind:class="{active: isActive, line: isLine}">{{message}}</h2><!--可在后台更改类名-->
</div>

<script src="../../js/vue.js"></script>
<script>
    const app = new Vue({
        el: '#app',
        data: {
            message: '你好啊',
            isActive: true,/*默认为true*/
            isLine: true
        },
        methods:{
            btnClick: function () {
                this.isActive =!this.isActive
            },
            getClasses: function () {
                return {active: this.isActive, line: this.isLine}
            }
        }
    })
</script>

</body>
</html>